package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.domain.entity.QuestionAnswer;
import com.example.mapper.QuestionAnswerMapper;
import com.example.service.QuestionAnswerService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (QuestionAnswer)表服务实现类
 *
 * @author makejava
 * @since 2022-03-06 11:23:56
 */
@Service("questionAnswerService")
public class QuestionAnswerServiceImpl extends ServiceImpl<QuestionAnswerMapper, QuestionAnswer> implements QuestionAnswerService {
    @Override
    public int addQuestionAnswer(QuestionAnswer questionAnswer) {
        return this.baseMapper.insert(questionAnswer);

    }

    @Override
    public List<QuestionAnswer> getQAList(Long questionId) {
        QueryWrapper<QuestionAnswer> qw=new QueryWrapper<>();
        qw.eq("question_id",questionId);
        return baseMapper.selectList(qw);
    }

    @Override
    public void deleteQuestionAnswer(LambdaQueryWrapper<QuestionAnswer> qw) {
        this.baseMapper.delete(qw);
    }
}

